//	Company:	HTHK
//	NAME:	    ProjectCategoryProcess.java
//	TITLE:	    The maintence of Project Category in Time Sheet System
//	FUNCTION:	The DDL interface of class ProjectCategory associate with the table
//	BY:	        Kodak Xu
//	DATE:	    09/12/2003
// --------------------------------------------------------------
// MODIFICATION HISTORY
// --------------------------------------------------------------
//	CR Log #:  99999  BY:  XXXX   DATE:  dd/mm/yyyy
//	ERROR:	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//	FIX:	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// --------------------------------------------------------------
package tss.projectcategory;

import com.ffpc.sql.*;

import java.sql.*;
import java.util.Vector;

public class ProjectCategoryProcess
{
    public static ProjectCategoryBean createBean()
    {
        return new ProjectCategory();
    }

    public static int insert(Connection con, ProjectCategoryBean projectCategoryBean)
      throws DataException
    {
        ProjectCategory projectCategory = (ProjectCategory)projectCategoryBean;
        projectCategory.setConnection(con);
        return projectCategory.insert();
    }

    public static int update(Connection con, ProjectCategoryBean projectCategoryBean)
      throws DataException
    {
        ProjectCategory projectCategory = (ProjectCategory)projectCategoryBean;
        projectCategory.setConnection(con);
        return projectCategory.update();
    }

    public static int delete(Connection con, ProjectCategoryBean projectCategoryBean)
      throws DataException
    {
        ProjectCategory projectCategory = (ProjectCategory)projectCategoryBean;
        projectCategory.setConnection(con);
        return projectCategory.delete();
    }

    public static ProjectCategoryBean[] find(Connection con, ProjectCategoryBean projectCategoryBean)
      throws DataException
    {
        
        ProjectCategory projectCategory = (ProjectCategory)projectCategoryBean;
        
        BaseSqlCommand buc = new BaseSqlCommand(con);
        Vector rows = buc.find(projectCategory);
        ProjectCategoryBean[] beans = new ProjectCategory[rows.size()];
        
        for (int i=0;i<rows.size();i++)
        {
            ProjectCategory bean = new ProjectCategory();
            bean.setColumns((Column[])rows.get(i));
            beans[i] = bean;
        
        }
        return beans;
    }
}
